Program automatic converting method and program automatic converting device

ABSTRACT

Automatic program conversion method: An analysis step analyzes the number of times that first instruction pattern information elements appear in an old source program; an analysis results output step outputs the analysis results; an instruction pattern conversion step converts old source program descriptions that correspond to the first instruction pattern information elements analyzed to appear a specified number of times or more, so as to correspond to second instruction pattern information elements; a new program output step outputs a new program resulting from the old source program converted in the instruction pattern conversion step; and an input receiving step receives user-entered manual input regarding the descriptions in the old source program that correspond to the first instruction pattern information elements analyzed to appear less than the specified number of times, so that such descriptions are modified for a new source program. Thus, program migration is achieved efficiently, reducing bugs.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to automatic program conversion devicescapable of analyzing computer programs and converting them in part orwhole.

2. Description of the Related Art

Conventionally, several techniques have been employed for the automaticconversion of computer programs, and those that are for source programsand program scripts can be cited to begin with. In these conversiontechniques, differences in description are automatically detected byobtaining compiler differences, and are automatically modified or a listis made thereof to improve efficiency in development. With them, asource program written in C language is parsed into tokens, and adatabase as well as an intermediate file is created for each token. Thenrelevant character strings are removed from or modified in the databaseto create a C language file from the information in the database andintermediate file, and thereby a target program is generated.

Secondly, another technique that may be cited is one in which based onprogram objects developed on a certain computer, software executable onanother platform is automatically generated. In this technique, objectcode that can be executed under the computer resources provided isdivided by a segment divider into an instruction code area and a datacode area. Then the instruction code area is analyzed for instructionsets and OS primitives by an instruction code converter for conversioninto statements written in a high-level programming language, while thedata code area is checked on a data type that corresponds to a type ofthe instruction referencing, and then the data code area is converted bya data syntax converter into data definitions written in the high-levelprogramming language. Then, using a reference area converter, the datadefinitions are assigned reference names, and are converted into a formin which the statements refer to the reference names. In this manner ahigh-level language program is generated.

With the first conventional technique, however, the premise is thatconversion is automatically performed on every instruction that fallswithin the scope of the specification of a programming language used towrite the source program to be converted. In terms of the secondconventional technique, presumably, every program object present on acertain computer is subjected to automatic conversion.

In other words, it is not taken into account in either technique that aprogram in question will still be efficiently executable after beingtransferred to a different operating environment, so as to ensure thatprogram's operating environment. Therefore, with the conventionaltechniques, which instruction patterns should undergo automatic ormanual conversion is not distinguishable at all. This means that whendeveloping an automatic conversion program capable of converting aprogram in a full- or semi-automatic manner, a programmer relying on theconventional techniques is unable to decide, in pursuit of conversionefficiency, which instruction pattern he or she should work on within asource program. Specifically, when using the conventional techniques,presumably, one has no choice but to develop a program thatautomatically converts even instruction patterns appearing only once.

SUMMARY OF THE INVENTION

Therefore, in order to overcome the drawbacks inherent in the prior art,a first aspect of the present invention is to provide an automaticprogram conversion method for making a program running in oneenvironment executable in other environments. This method includes:where at least one pair of a first instruction pattern informationelement indicating an instruction pattern in an old source program, anda second instruction pattern information element indicating aninstruction pattern in a new source program is stored in a memory part,an analysis step of analyzing, using an analysis means, the number oftimes that each of the first instruction pattern information elementsappears in the old source program; an analysis results output step ofoutputting, using an output means, analysis results obtained in theanalysis step; an instruction pattern conversion step of converting,using a conversion means, the descriptions in the old source programthat correspond to the first instruction pattern information elementsanalyzed, in the analysis step, to appear a specified number of times ormore (specify a number greater than one), so as to correspond to thesecond instruction pattern information elements that are individuallypaired with those first instruction pattern information elements; a newprogram output step of outputting a new source program resulting fromthe conversion of the old source program in the instruction patternconversion step; and an input receiving step of receiving input,manually entered by a user using an input means, regarding thedescriptions in the old source program that correspond to the firstinstruction pattern information elements analyzed, in the analysis step,to appear less than the specified number of times, so that thosedescriptions will be modified for the new source program. Therebyprogram migration can be achieved efficiently, reducing bugs.

In accordance with a second aspect of the present invention, the newprogram output step set forth above is to output the descriptions,having undergone the conversion in the instruction pattern conversionstep, visually distinct from the other unconverted descriptions, withina new source program. Thereby, a programmer can visually check a programafter conversion in an efficient manner.

It should be noted that the above program conversion method may berealized by software or hardware such as a dedicated circuit. In fact,the above capability is accomplished in the form of a program or anautomatic program conversion device. Moreover, this conversion methodcan be considered a program creation method capable of creating aprogram compatible with a migration destination.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a program analyzer in accordance with afirst embodiment of the present invention.

FIG. 2 is a flowchart depicting operations of the program analyzer inaccordance with the first embodiment of the present invention.

FIG. 3 is an instruction pattern information management table inaccordance with the first embodiment of the present invention.

FIG. 4 is an instruction pattern appearance count management table inaccordance with the first embodiment of the present invention.

FIG. 5 shows an example of a program in accordance with the firstembodiment of the present invention.

FIG. 6 is another instruction pattern appearance count management tablein accordance with the first embodiment of the present invention.

FIG. 7 is yet another instruction pattern appearance count managementtable in accordance with the first embodiment of the present invention.

FIG. 8 shows an example of analysis results in accordance with the firstembodiment of the present invention.

FIG. 9 shows an example of displaying analysis results in accordancewith the first embodiment of the present invention.

FIG. 10 is a block diagram of an automatic program converter inaccordance with a second embodiment of the present invention.

FIG. 11 is a flowchart depicting operations of the automatic programconverter in accordance with the second embodiment of the presentinvention.

FIG. 12 is an instruction pattern information management table inaccordance with the second embodiment of the present invention.

FIG. 13 shows an example of a new program after conversion in accordancewith the second embodiment of the present invention.

FIG. 14 shows another example of a new program in accordance with thesecond embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Preferred embodiments of a program analysis device and an automaticprogram conversion device of the present invention will be discussedhereinafter by referring to the accompanying drawings. Here note thatthe same reference numerals are used throughout the drawings and thedescription in order to refer to the same or like constituent elementsin terms of behavior or function, and descriptions thereof will not berepeated.

Embodiment 1

Referring to FIG. 1, a block diagram illustrating a program analyzer ofthe present invention is shown. As illustrated therein, the programanalyzer includes an instruction pattern information storage part 101, aprogram storage part 102, an analysis part 103, and an analysis resultsoutput part 104. The analyzer may be a personal computer incorporatingan MPU, a memory, a hard disk, and the like.

The instruction pattern information storage part 101 stores at least oneinstruction pattern information element indicating an instructionpattern in a relevant program, and can be realized by either anon-volatile memory device or a volatile memory device.

The program storage part 102 is literally storage of a program, and canbe realized by either a non-volatile memory device or a volatile memorydevice. The “program” in this context refers to a source programregardless of language, and includes so-called scripts such as HTML andXML. In addition, both procedural and declarative scripts areacceptable, and data sets required for a program to be executed (such asa header file) are included.

The analysis part 103 analyzes how many times each of the instructionpattern information elements appears (i.e., appearance count) in aprogram stored in the program storage part 102. The analysis part 103can be realized in general by using an MPU, a memory, and the like.Processes assigned to the analysis part 103 are implemented in generalby software, which is stored in a memory device such as ROM. It shouldbe noted that the processes may be alternatively implemented by hardware(using a dedicated circuit).

The analysis results output part 104 outputs analysis results producedin the analysis part 103. Here the output would usually mean “display ona screen,” but may not be limited to this and connotes printing to aprinter or sending out to other devices. In addition, storing tohardware such as a memory device is also implied when referring tooutputting. Moreover, the output part 104 may be with or without anoutput display, and can be realized, for example, by driver software foran output device.

Operations of the program analysis device in the first embodiment willbe discussed hereinafter by referring to the flowchart shown in FIG. 2.

In step S201, the analysis part 103 reads-in a program from the programstorage part 102, in which a program to be analyzed is stored. If morethan one program exists in the storage part 102, the analysis part 103,for example, reads-in a program specified by a user.

In step S202, the analysis part 103 reads-in the at least oneinstruction pattern information element stored in the instructionpattern information storage part 101.

In step S203, the analysis part 103 resets the appearance count to 0(zero) for all instruction patterns. Here note that all appearancecounts are retained for each instruction pattern, for example, in amemory inside the analysis part 103.

In step S204, the analysis part 103 sets 1 (one) to a counter i. Thiscounter serves as a program counter for a program read in S201, and inaccordance with this counter, the analysis part 103 analyzes the ithline of the program read in S201 through the following processes. Notethat the program here is assumed to have one instruction per line.

In step S205, the analysis part 103 judges whether or not the ithprogram source line is present in the program read-in. If the ith lineexists, the analysis part 103 proceeds to S206; otherwise, it skips toS213.

In step S206, the analysis part 103 sets 1 (one) to a counter j. Thiscounter serves in obtaining instruction pattern information used in theanalysis from the at least one instruction pattern information elementread in S202.

In step S207, the analysis part 103 judges whether or not the ithprogram source line corresponds to the jth instruction patterninformation element. If the correspondence is confirmed, the analysispart 103 proceeds to S208; otherwise, it skips to S210. Furtherdescription is omitted because whether or not the ith program sourcecorresponds to the jth instruction pattern information element can bejudged by means of an existing technique such as lexical analysis orparsing.

In step S208, the analysis part 103 increments the appearance count byone for the instruction pattern that corresponds to the jth instructionpattern information element.

In step S209, the analysis part 103 increments the counter i, thenreturns to S205.

In step S210, the analysis part 103 increments the counter j.

In step S211, the analysis part 103 judges whether or not the jthinstruction pattern is present in the instruction pattern informationstorage part 101. If the pattern in question exists, the analysis part103 returns to S207; otherwise, it proceeds to S212.

In step S212, the analysis part 103 outputs an error notice, “Nocorrespondence was found for the instruction pattern in question.” Notethat this process is not mandatory.

In step S213, the analysis results output part 104 outputs analysisresults. The “analysis result” in this context refers to the number ofinstruction pattern appearances for each instruction pattern informationelement.

Hereinafter, the operations of the program analysis device in the firstembodiment will be discussed in detail. FIG. 3 shows an instructionpattern information management table retained in the instruction patterninformation storage part 101. In this table, more than one record isstacked under the common headings of “ID” and “Instruction PatternInformation.” IDs are used for identifying each record and useful forhandling multiple tables. “Instruction Pattern Information” containsattribute values indicating instruction pattern information.

FIG. 4 shows an instruction pattern appearance count management tableretained in the analysis part 103. In this table, at least one record isstored under the headings of “ID” and “Appearance Count.” IDs in thistable correspond to those in the table shown in FIG. 3. “AppearanceCount” indicates how many times a relevant instruction pattern appears.The default value is 0 (zero).

FIG. 5 shows an example of a program stored in the program storage part102. The program analysis device commences analyzing a program as shownin FIG. 5 upon request from a user. Comment lines always start with anasterisk (*). Here note that the program analysis device refrains fromanalyzing a line if it is judged to be a comment line, and then moves tothe following line.

First, the analysis part 103 reads-in the first line of the programshown in FIG. 5. Since the first line is a comment, the analysis part103 ignores it and moves onto the following line (i.e., increments theprogram counter). Again, the analysis is not performed on the secondthrough eighth lines for the same reason.

When coming to the ninth line, the analysis part 103 reads-in“IDENTIFICATION DIVISION.” and judges the ninth line corresponds to theinstruction pattern information element whose ID is 1 in the instructionpattern information management table (FIG. 3). Then the analysis part103 increments by one the “Appearance Count” value in the record whoseID is 1 in the instruction pattern appearance count management table(FIG. 4). A resultant table is shown in FIG. 6.

Proceeding to the tenth line, the analysis part 103 reads-in“PROGRAM-ID. PSD712.” and judges the line corresponds to the instructionpattern information element whose ID is 2 in the information managementtable (FIG. 3). It should be noted that the terms “VARIABLE01,”“VARIABLE02” and the like represent a variable, which is composed of analphanumeric character string. In the tenth line “PSD712” is a variable.When the judgment is completed, the analysis part 103 increments by onethe “Appearance Count” value, where ID is 2 in the instruction patternappearance count management table.

The processing as described above is repeated on all the lines withinthe program in FIG. 5, and a resultant table is obtained as shown inFIG. 7, which is an instruction pattern appearance count managementtable.

Subsequent to this, the analysis results output part 104 outputsanalysis results as shown in FIG. 8. The analysis results are summarizedunder the headings of “ID,” “AC”, and “Instruction Pattern Information”.Here “AC” stands for Appearance Count. The results in FIG. 8 arecomposed of the instruction pattern information management table in FIG.3 and the instruction pattern appearance count management table in FIG.7. More specifically, so that two tables (FIGS. 3 and 7 in this case)are merged in accordance with a column that they have in common so as toform a single table as shown in FIG. 8, a join operation is performed,where values in the “ID” column are used as a join condition.

As clarified above, the first embodiment of the present inventionenables the analysis of instruction patterns within a source programthat needs to be converted, whereby an automatic conversion programcapable of efficiently converting source programs can be developed. Notethat how programs are automatically converted based on the analysisresults obtained in the first embodiment will be discussed hereinafterin the second embodiment.

Another important aspect of the first embodiment is that thoseinstruction patterns appearing more than a given number of times may bedisplayed so as to stand out from the others. Doing so produces analysisresults as shown in FIG. 9, for example. In the case of FIG 9, theinstruction patterns appearing three times or more are underlined. Herenote that in order to achieve the same effect, the embodiment is notlimited to that of FIG. 9, and various alternatives are acceptable.

The operations described in the first embodiment may be realized by acomputer-readable program. For this, the program may be distributed in arecording medium such as CD-ROM or through a network, or may bebroadcast, and the same will apply to any embodiments other than this.It should be noted that a program capable of executing the operations inthe first embodiment is provided so that in a computer storing at leastone instruction pattern information element indicating an instructionpattern in a program, an analysis step of analyzing the number of timesthat each of the instruction pattern information elements appears (i.e.,appearance count) in the program, and an analysis results output step ofoutputting analysis results obtained in the analysis step are performed.

In addition, in order to perform the program analysis, a single deviceis employed in the first embodiment, but this process may be executed bysharing the task among multiple devices. In other words, the same effectas described above will be achieved if program analysis can be completedin combination with more than one device using a program analysismethod. Here the program analysis method includes: where at least oneinstruction pattern information element indicating an instructionpattern in a program is stored, an analysis step of analyzing the numberof times that each of the instruction pattern information elementsappears (i.e., appearance count) in the program, and an analysis resultsoutput step of outputting analysis results obtained in the analysisstep.

Embodiment 2

Referring to FIG. 10, a block diagram illustrating an automatic programconversion device of the present invention is shown. As illustratedtherein, the automatic program conversion device includes an instructionpattern correspondence information storage part 1001, a program storagepart 102, an analysis part 103, a condition storage part 1002, aninstruction pattern conversion part 1003, and a new program output part1004. For this, a personal computer incorporating an MPU, a memory, ahard disk, and the like is employed.

The instruction pattern correspondence information storage part 1001stores at least one pair of a first instruction pattern informationelement indicating an instruction pattern in an old program (program tobe converted), and a second instruction pattern information elementindicating an instruction pattern in a new program (program havingundergone conversion). The correspondence storage part 1001 can berealized by either a non-volatile memory device or a volatile memorydevice.

The condition storage part 1002 stores conditions used for automaticallyconverting part of an old program that corresponds to first instructionpattern information elements, so as to correspond to second instructionpattern information elements. The condition storage part 1002 can berealized by either a non-volatile memory device or volatile memorydevice. In most cases the conditions are embedded in a program forexecuting the process assigned to the instruction pattern conversionpart 1003 (including a case in which conditions are defined in a headerfile). Also note that the conditions are based on the analysis resultsobtained from the analysis part 103.

The instruction pattern conversion part 1003 performs a conversionprocess on a program stored in the program storage part 102 (an oldprogram) so that part of the old program corresponding to the firstinstruction pattern information element that meets a condition stored inthe condition storage part 1002 corresponds to the second instructionpattern information element that is paired with the first instructionpattern information element. The conversion part 1003 can be realized ingeneral using an MPU and a memory. Processes required for the conversionpart 1003 to convert relevant information is generally realized bysoftware, which is stored in a memory device such as ROM. This may be,however, substituted for by hardware (using a dedicated circuit).

The new program output part 1004 outputs the outcome of the programconversion performed by the program conversion part 1003 as a newprogram. Here the output would usually mean “display on a screen”;however, this includes printing to a printer, sending out to otherdevices, and recording to a recording medium (a hard disk, digitalmulti-purpose disc, or the like). The output part 1004 may be with orwithout an output display or a recording medium, and can be realized,for example, by driver software for an output device.

Operations of the automatic program conversion device in the secondembodiment will be discussed hereinafter by referring to the flowchartshown in FIG. 11.

In step S1101, a program analysis routine is executed. Through thisroutine a program analysis is completed as already discussed using theflowchart in FIG. 2, and the appearance count is output for eachinstruction pattern accordingly.

In step S1102, the instruction pattern conversion part 1003 reads-in aprogram stored in the program storage part 102. If more than one programexists, the conversion part 1003 reads-in a program specified by a user.

In step S1103, the conversion part 1003 reads-in the at least one firstinstruction pattern information element stored in the instructionpattern correspondence information storage part 1001.

In step 1104, the conversion part 1003 sets 1 (one) to a counter i. Thiscounter serves as a program counter for a program read in S1102. Inother words, the conversion part 1003 converts the ith line of theprogram read in S1102 through the following processes. Note that theprogram here is assumed to have one instruction per line.

In step S1105, the conversion part 1003 judges whether or not a programsource is present in the ith line of the program read in S102. If therelevant source exists, then the conversion part 1003 proceeds to S1106;otherwise, it skips to S1116.

In step S1106, the conversion part 1003 sets 1 (one) to a counter j.This counter serves in obtaining first instruction pattern informationfor use in the conversion from the at least one first instructionpattern information element read in S1103.

In step S1107, the conversion part 1003 judges whether or not theprogram source in the ith line corresponds to the jth first instructionpattern information element. If the correspondence is confirmed, theconversion part 1003 proceeds to S1108; otherwise, it skips to S1113.

It should be noted that whether or not the ith program sourcecorresponds to the jth first instruction pattern information element canbe judged by means of lexical analysis or parsing.

In step S1108, the conversion part 1003 judges whether or not the jthfirst instruction pattern information element meets a condition in thecondition storage part 1002, based on the analysis results obtained fromthe program analysis routine in S1101. If the condition is met, theconversion part 1003 proceeds to S1109; otherwise, it skips to S1115.

In step S1109, from the instruction pattern correspondence informationstorage part 1001, the conversion part 1003 obtains the secondinstruction pattern information element that is paired with the jthfirst instruction pattern information element.

In step S1110, the conversion part 1003 converts the ith program sourceinto a pattern as indicated by the second instruction patterninformation element obtained in S1109.

In step S1111, the conversion part 1003 adds the ith source, having beenconverted in S1110, to a new program. Note that the new program isassumed to be in a file, for which file generation and opening werecompleted at the time of initialization (not shown).

In step S1112, after incrementing the counter i, the conversion part1003 returns to S1105.

In step S1113, the counter j is incremented.

In step S1114, the conversion part 1003 judges whether or not the jthfirst instruction pattern information element exists. If it exists, theconversion part 1003 returns to S1107; otherwise, it moves onto S1115.

In step S1115, the conversion part 1003 adds the ith source to a newprogram. In this example, the ith source is a comment line.

In step S1116, the new program output part 1004 outputs a program havingundergone the conversion (a new program). The “output” in this contextcan include simple storage to a recording medium such as a hard disk.

It should be noted that instruction pattern elements failing to meet theconditions in the condition storage part 1002 and left unconverted intotheir corresponding second instruction patterns will be manuallyrewritten by a programmer using an input means such as a keyboard. Thismeans that the automatic program conversion device includes an inputmeans such as a key board or mouse, not shown in the figures.

Hereinafter, the operations of the automatic program conversion devicein the second embodiment will be discussed in detail. FIG. 12 shows aninstruction pattern information management table stored in theinstruction pattern correspondence information storage part 1001. Inthis table, more than one record is stacked under the common headings of“ID,” “First Instruction Pattern Information,” and “Second InstructionPattern Information.” IDs are used for identifying each record. Thismanagement table is used as a correspondence table when conversion takesplace in search of the correspondence between the source lines inquestion appearing in a program as the first instruction patterninformation elements, and the second instruction pattern informationelements that are individually paired with them. Specifically, referringto FIG. 12, “SOURCE-COMPUTER. XXXXXX.” in the “First Instruction PatternInformation” column is converted into “#CHG# SOURCE-COMPUTER.IBM-AS400.” as indicated in the “Second Instruction Pattern Information”column. Here “XXXXXX” represents any variable name, and “#DEL#”represents the deletion of the corresponding portion. “#CHG#” means thatthe corresponding portion is the outcome of the conversion. Moreover,lines with an asterisk (*) are comment lines, where each comment isplaced between #'s.

Referring to FIG. 5, an old program stored in the program storage part102 is shown as an example, and referring to FIG. 8, an instructionpattern appearance count management table is shown involving theanalysis results obtained by the analysis part 103. In addition, thecondition storage part 1002 is assumed to retain a condition thatprogram lines as indicated in the “First Instruction PatternInformation” column are to be converted into their corresponding secondinstruction pattern information elements, if the number of theirappearances happens to be two or more.

Subsequent to the conversion of the old program in FIG. 5 using theinstruction pattern conversion part 1003, a new program created therebyis outputted from the new program output part 1004. The new program isas shown in FIG. 13, where newly created lines are underlined so thatthey are recognized as those having undergone the conversion, differingfrom the others.

In the new program (FIG. 13), the lines numbered “(1)” underwent theconversion in accordance with ID 1 in the instruction patterninformation management table. Likewise, the lines numbered “(2)” areconverted lines in accordance with ID 2.

It should be noted that referring to FIG. 12, only one example is shownof the instruction pattern information management table for the sake ofbrevity, where the new program corresponds to the old program on aper-n-lines basis (n is a positive integer). However, a correspondenceratio of a new program to an old program can also be n to m lines, wheren is a positive integer, and m is any positive integer greater than one.

In accordance with the second embodiment of the present invention,instruction patterns appearing in a source program to be converted canbe analyzed, and thereby full- or semi-automatic conversion can beefficiently achieved. In fact, a programmer will readily engage inconversion work on instruction patterns if limited infrequency, whileother instruction patterns appearing a specified number of times (e.g.,twice) or more require complex and time-consuming work, and are betterleft to a conversion program. Thus in the preferred embodiments of thepresent invention a source program conversion program is developed inadvance, so that program conversion is efficiently performed in anautomatic fashion. On top of that by using the automatic programconversion device in the second embodiment, for example, programmigration from one operating environment to another can be implementedin an even more efficient and secure manner.

As stated above, in accordance with the second embodiment, theinstruction patterns appearing less than a specified number of times areto be modified manually. For this, the automatic program conversiondevice includes an input means in order for a programmer to carry outmanual modification. Here the “input means” is a keyboard or a mouse,for example.

As shown in FIG. 14, in which portions manually modified, portionsautomatically converted, and portions unconverted are shown as suchindividually within a new program, storage of or screen display of thenew program may also be implemented in the second embodiment. In FIG.14, a comment between @'s indicates how a relevant line was manuallyprocessed. “@DEL@” represents manually deleted, and “@ADD@,” manuallyadded.

In the second embodiment, in order to determine whether to performconversion automatically or manually, the number of times that each ofthe first instruction pattern information elements appears in a programis used as a parameter (i.e., in the above example, automatic conversionis performed on condition that the appearance count is two or more.)However, the conversion type may be determined using other conditions.Also, another feasible configuration is one in which first instructionpatterns that will be automatically converted are specified inaccordance with input from a user.

The operations described in the second embodiment may be realized by acomputer-readable program. For this, the program may be distributed in arecording medium such as CD-ROM or through a network, or may bebroadcast. This applies to any embodiments other than this. It should benoted that a program capable of executing the operations in the secondembodiment is provided, so that performed in a computer storing at leastone pair of a first instruction pattern information element indicatingan instruction pattern in an old source program, and a secondinstruction pattern information element indicating an instructionpattern in a new source program are: an analysis step of analyzing thenumber of times that each of the first instruction pattern informationelements appears (i.e., appearance count) in the old source program; ananalysis results output step of outputting analysis results obtained inthe analysis step; an instruction pattern conversion step of convertingthe descriptions in the old source program that correspond to the firstinstruction pattern information elements analyzed, in the analysis step,to appear a specified number of times or more (specify a number greaterthan one), so as to correspond to the second instruction patterninformation elements that are individually paired with theconversion-target first instruction pattern information elements; a newprogram output step of outputting a new program resulting from theconversion of the old source program in the instruction patternconversion step; and an input receiving step of receiving input manuallyentered by a user, regarding the descriptions in the old source programthat correspond to the first instruction pattern information elementsanalyzed, in the analysis step, to appear less than the specified numberof times, so that those descriptions will be modified for the newprogram.

Moreover, in order to perform the program conversion, a single automaticprogram conversion device is employed in the second embodiment, but theconversion process may be performed by sharing the task among multipledevices. In other words, it is also acceptable that more than one deviceis employed for implementing an automatic program conversion methodcharacterized as follows. Provided for making a program running in oneenvironment executable in other environments, the method includes: whereat least one pair of a first instruction pattern information elementindicating an instruction pattern in an old source program and a secondinformation pattern information element indicating an instructionpatterns in a new source program is stored in a memory part, an analysisstep of analyzing, using an analysis means, the number of times thateach of the first instruction pattern information elements appears(i.e., appearance count) in the old source program; an analysis resultsoutput step of outputting, using an output means, analysis resultsobtained in the analysis step; an instruction pattern conversion step ofconverting, using a conversion means, the descriptions in the old sourceprogram that correspond to the fist instruction pattern informationelements analyzed, in the analysis step, to appear a specified number oftimes or more (specify a number greater than one), so as to correspondto the second instruction pattern information elements that areindividually paired with the conversion-target first instruction patterninformation elements; a new program output step of outputting, using anoutput means, a new source program resulting from the conversion of theold source program in the instruction pattern conversion step; and aninput receiving step of receiving input, manually entered by a userusing an input means, regarding the descriptions in the old sourceprogram that correspond to the first instruction pattern informationelements analyzed, in the analysis step, to appear less than thespecified number of times, so that those descriptions will be modifiedfor the new source program. Thereby program migration is achievedefficiently, reducing bugs.

In addition, the above automatic program conversion device in the secondembodiment can be interpreted as a device capable of implementing amethod of creating a program running in a new environment (i.e., anenvironment into which the program is migrated). More specifically, theautomatic program conversion device implements a program creation methodcharacterized as follows. Provided for creating a program for making aprogram running in one environment executable in other environments, theprogram creation method includes: where at least one pair of a firstinstruction pattern information element indicating an instructionpattern in an old source program, and a second instruction patterninformation element indicating an instruction pattern in a new sourceprogram is stored in a memory part, an analysis step of analyzing, usingan analysis means, the number of times that each of the firstinstruction pattern information elements appears (i.e., appearancecount) in the old source program; an analysis results output step ofoutputting, using an output means, analysis results obtained in theanalysis step; an instruction pattern conversion step of converting,using a conversion means, the descriptions in the old source programthat correspond to the first instruction pattern information elementsanalyzed, in the analysis step, to appear a specified number of times ormore (specify a number greater than one), so as to correspond to thesecond instruction pattern information elements that are individuallypaired with the conversion-target first instruction pattern informationelements; a new program output step of outputting, using an outputmeans, a new source program resulting from the conversion of the oldsource program in the instruction pattern conversion step; and an inputreceiving step of receiving input, manually entered by a user using aninput means, regarding the descriptions in the old source program thatcorrespond to the first instruction pattern information elementsanalyzed, in the analysis step, to appear less than the specified numberof times, so that those descriptions will be modified for the new sourceprogram. Here the new program output step may include a feature that thedescriptions having undergone the conversion in the instruction patternconversion step are outputted visually distinct from the otherunconverted descriptions, within a new source program.

Also, in accordance with the second embodiment, a program creationdevice capable of implementing the above program creation method can beinterpreted as a device capable of creating a program that is operablein a new environment (i.e., an environment into which the program ismigrated). Specifically, provided for creating from an old sourceprogram running in one environment a new source program executable inother environments, the program creation device includes: an instructionpattern correspondence information storage part, in which at least onepair of a first instruction pattern information element indicating aninstruction pattern in an old source program, and a second instructionpattern information element indicating an instruction pattern in a newsource program is stored, an analysis part for analyzing the number oftimes that each of the first instruction pattern information elementsappears (i.e., appearance count) in the old source program; an analysisresults output part for outputting analysis results obtained by theanalysis part; an instruction pattern conversion part for converting thedescriptions in the old source program that correspond to the firstinstruction pattern information elements analyzed by the analysis partto appear a specified number of times or more (specify a number greaterthan one), so as to correspond to the second instruction patterninformation elements that are individually paired with theconversion-target first instruction pattern information elements; a newprogram output part for outputting a new program resulting from theconversion of the old program in the instruction pattern conversionpart; and an input receiving part for receiving input manually enteredby a user, regarding the descriptions in the old source program thatcorrespond to the first instruction pattern information elementsanalyzed by the analysis part to appear less than the specified numberof times, so that those descriptions will be modified for the new sourceprogram. Here the new program output part may output the descriptions,having undergone the conversion by the instruction pattern conversionpart, visually distinct from the other unconverted descriptions, withina new source program.

The embodiments of the invention disclosed herein are those consideredto be preferred, and various changes and/or modifications can be madewithout departing from the scope of the invention. The scope of theinvention is indicated by the appended claims rather than by theforegoing description, and all changes and/or modifications that comewithin the meaning and range of equivalency of the claims are intendedto be embraced therein.

INDUSTRIAL APPLICABILITY

The method and device for the program conversion, and the like inaccordance with the present invention provide for the analysis ofinstruction patterns within a program to be converted. Thus they areeffective for use as a method and a device for efficient migration ofcomputer programs.

1. An automatic program conversion method for making a program runningin one environment executable in other environments, said conversionmethod comprising: where at least one pair of a first instructionpattern information element representing an instruction pattern in anold source program and a second instruction pattern information elementrepresenting an instruction pattern in a new source program is stored ina memory part, an analysis step of analyzing, using an analysis means, anumber of times that said first instruction pattern information elementappears in said old source program; an analysis results output step ofoutputting, using an output means, analysis results obtained in saidanalysis step; an instruction pattern conversion step of converting,using a conversion means, descriptions in said old source program thatcorrespond to said first instruction pattern information elementanalyzed, in said analysis step, as appearing a predetermined number oftimes or more, so as to correspond to said second instruction patterninformation element that is paired with said first instruction patterninformation element appearing said predetermined number of times ormore; a new program output step of outputting, using an output means, anew source program resulting from said old source program having beenconverted in said instruction pattern conversion step; and an inputreceiving step of receiving input, manually entered by a user using aninput means, regarding descriptions in said old source program thatcorrespond to said first instruction pattern information elementanalyzed, in said analysis step, as appearing less than saidpredetermined number of times, so that said descriptions will bemodified for said new source program.
 2. The automatic programconversion method as defined in claim 1, wherein said new program outputstep outputs said descriptions, having been converted in saidinstruction pattern conversion step, visually distinct from unconverteddescriptions, in said new source program.
 3. A computer program forperforming: where at least one pair of a first instruction patterninformation element representing an instruction pattern in an old sourceprogram and a second instruction pattern information elementrepresenting an instruction pattern in a new source program is stored ina computer, an analysis step of analyzing a number of times that saidfirst instruction pattern information element appears in said sourceprogram; an analysis results output step of outputting analysis resultsobtained in said analysis step; an instruction pattern conversion stepof converting descriptions in said old source program that correspond tosaid first instruction pattern information element analyzed, in saidanalysis step, as appearing a predetermined number of times or more, soas to correspond to said second instruction pattern information elementthat is paired with said first instruction pattern information elementappearing said predetermined number of times or more; a new programoutput step of outputting a new program resulting from said old sourceprogram having been converted in said instruction pattern conversionstep; and an input receiving step of receiving input manually entered bya user, regarding descriptions in said old source program thatcorrespond to said first instruction pattern information elementanalyzed, in said analysis step, as appearing less than saidpredetermined number of times, so that said descriptions will bemodified for said new source program.
 4. The program as defined in claim3, wherein said new program output step outputs said descriptions,having been converted in said instruction pattern conversion step,visually distinct from unconverted descriptions, in said new sourceprogram.
 5. An automatic program conversion device comprising: aninstruction pattern correspondence information storage part, wherein atleast one pair of a first instruction pattern information elementrepresenting an instruction pattern in an old source program and asecond instruction pattern information element representing aninstruction pattern in a new source program is stored; an analysis partfor analyzing a number of times that said first instruction patterninformation element appears in said source program; an analysis resultsoutput part for outputting analysis results obtained in said analysispart; an instruction pattern conversion part for converting descriptionsin said source program that correspond to said first instruction patterninformation element analyzed, in said analysis part, as appearing apredetermined number of times or more, so as to correspond to saidsecond instruction pattern information element that is paired with saidfirst instruction pattern information element appearing saidpredetermined number of times or more; a new program output part foroutputting a new source program resulting from said old source programhaving been converted in said instruction pattern conversion part; andan input receiving part for receiving input manually entered by a user,regarding descriptions in said old source program that correspond tosaid first instruction pattern information element analyzed, in saidanalysis part, as appearing less than said predetermined number oftimes, so that said descriptions will be modified for said new sourceprogram.
 6. The automatic program conversion device as defined in claim5, wherein said new program output part outputs said descriptions,having been converted in said instruction pattern conversion part,visually distinct from unconverted descriptions, in said source program.7. A program creation method for creating a program capable of creatingfrom an old source program running in one environment a new sourceprogram executable in other environments, said method comprising: ananalysis step of analyzing a number of times that at least one firstinstruction pattern information element appears in said old sourceprogram; an analysis results output step of outputting analysis resultsobtained in said analysis step; an instruction pattern conversion stepof converting descriptions in said old source program that correspond tosaid first instruction pattern information element analyzed, in saidanalysis step, as appearing a predetermined number of times or more, soas to correspond to a second instruction pattern information elementthat is paired with said first instruction pattern information elementappearing said predetermined number of times or more; a new programoutput step of outputting said new source program resulting from saidold source program having been converted in said instruction patternconversion step; and an input receiving step of receiving input manuallyentered by a user, regarding descriptions in said old source programthat correspond to said first instruction pattern information elementanalyzed, in said analysis step, as appearing less than saidpredetermined number of times, so that said descriptions will bemodified for said new source program.
 8. The program creation method asdefined in claim 7, wherein said new program output step outputs saiddescriptions, having been converted in said instruction patternconversion step, visually distinct from unconverted descriptions, insaid new source program.
 9. A program creation device for creating aprogram capable of creating from an old source program running in oneenvironment a new source program executable in other environments, saiddevice comprising: an instruction pattern correspondence informationstorage part, wherein at least one pair of a first instruction patterninformation element representing an instruction pattern in said oldsource program and a second instruction pattern information elementrepresenting an instruction pattern in said new source program isstored; an analysis part for analyzing a number of times that said firstinstruction pattern information element appears in said source program;an analysis results output part for outputting analysis results obtainedin said analysis part; an instruction pattern conversion part forconverting descriptions in said old source program that correspond tosaid first instruction pattern information element analyzed, in saidanalysis part, as appearing a predetermined number of times or more, soas to correspond to said second instruction pattern information elementthat is paired with said first instruction pattern information elementappearing said predetermined number of times or more; a new programoutput part for outputting said new source program resulting from saidold source program having been converted in said instruction patternconversion part; and an input receiving part for receiving inputmanually entered by a user, regarding descriptions in said old sourceprogram that correspond to said first instruction pattern informationelement analyzed, in said analysis part, as appearing less than saidpredetermined number of times, so that said descriptions will bemodified for said new source program.
 10. The program creation device asdefined in claim 9, wherein said new program output part outputs saiddescriptions, having been converted in said instruction patternconversion part, visually distinct from unconverted descriptions, insaid source program.